﻿using System;
using System.Collections.Generic;
using System.Text;

using FreeFlow.Administration;
using System.Windows.Forms;

namespace FreeFlowAdministrator
{
  public class WorkflowVersionAdaptor : Adaptor, IDeletable
  {
    private WorkflowVersion version;
    public WorkflowVersionAdaptor(WorkflowVersion version)
    {
      this.version = version;
    }

    public override string Text
    {
      get 
      {
        return version.Version;
      }
    }

    public override object Object
    {
      get 
      {
        return version; 
      }
    }

    public override int ImageIndex
    {
      get
      {
        return 13;
      }
    }

    public override Control GetRenderer()
    {
      WorkflowVersionControl control = new WorkflowVersionControl();
      control.LoadWorkflowVersion(version);
      control.ItemDeleted += new EventHandler(TriggerItemDeleted);
      return control;
    }

    #region IDeletable Members

    public void Delete()
    {
      version.Delete();
    }

    #endregion
  }
}
